package com.example.photongrid;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.util.ArrayList;


public class InputThread implements Runnable
{
    
    int angle;
    private static final String SERVER_IP = "127.0.0.1";
	private static final int SERVER_PORT = 4567;
	   
  
    String player1= "Player 1";
	static Socket socket = null;
	
	// Client's Local copies of the game data structures to be used by the UI in the future
	public static QuadTree localTree = new QuadTree();
	public static ArrayList<Player> localPlayerList = new ArrayList<Player>();
	public static ArrayList<Vehicle> localVehicleList = new ArrayList<Vehicle>();

	public static void connect(){
		 try 
			{	
				socket = new Socket(SERVER_IP, SERVER_PORT);
				System.out.println("Connected to server!");
			} 
			catch (Exception e) 
			{
				System.out.println("Error connecting to server: " + e.getMessage());
			}
	}
	//System.out.println("Connected to server!");
    ObjectInputStream in = null;
		ObjectOutputStream out = null;
	
    public void run() {
    	
		connect();
		ClientListeningThread listen = new ClientListeningThread(socket);
		Thread t2 = new Thread(listen);
		t2.start();
	
	}
    
     
   
     
}